<!DOCTYPE html> 
<html> 
	<head> 
	<title>UCParty</title> 
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
   <link rel="stylesheet" href="jquery/jquery.mobile-1.0.1.css" />
   <link rel="stylesheet" href="mobile.css" />
	<script src="jquery/jquery-1.7.1.min.js"></script>
	<script src="jquery/jquery.mobile-1.0.1.min.js"></script>
</head> 
<body> 

<!--  page tweet -->
<div data-role="page" id="tweet" data-theme="u">
	<div data-role="header" data-theme="u">
      <h1>Tweet</h1>
	</div><!-- /header -->
	<div data-role="content" id="twitter"></div><!-- /content -->
<script type="text/javascript">
(function($) {
     $.toLink = function(text) {
        var urlRegExp = /((ftp|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/gm;
        var newText = text.replace(urlRegExp, '<a href="$1">$1</a>');
        return newText;
    };
})(jQuery);
$(function() {
//var twitterBaseURL = 'http://twitter.com/status/user_timeline/gabromanato.json?count=10&callback=?';
var twitterBaseURL = 'http://search.twitter.com/search.json?callback=?&q=Ubuntuclub';
var html = '';
$('<ul />').appendTo('#twitter');
$.getJSON(twitterBaseURL, function(json) {
$.each(json.results, function(i, item) {
     var text = $.toLink(item.text);
     var profileImageURL = item.profile_image_url;
     html += '<li ><img src="' + profileImageURL + '" /><p class="balloon">' + text + '</p></li>';
     if (i==9) return false;
   });
   $('ul', '#twitter').html(html);
});
});
$.ajaxSetup({
    timeout: 1000, // Microseconds, for the laughs.  Guaranteed timeout.
    error: function(request, status, maybe_an_exception_object) {
        if(status = 'timeout')
           location.href="notconnect.html"
    }
});

</script>

 </div><!-- /page -->

</body>
</html>

